- /* scfacosh.cpp by K.Tsuru */
- // function ID = 9118 since ver 2.18
- // bug fix version 2.21
- /*****************************************
- SComplex class
- It returns arcosh(z).
- Cacosh(z) = Clog{z + Csqrt(z+1)*Csqrt(z-1)}.
- ={ i arccos(z) Im(z)>0
- { (-i)arccos(z) Im(z)<0
- Gradshteyn and Ryzhik (2000, p. xxx)
- [reference]WolframMathWorld's page
- Calculus and Analysis > Special Functions > Hyperbolic Functions >
- Interactive Entries > webMathematica Examples >
- Inverse Hyperbolic Cosine
- ver 2.21
- When z = x(pure real),let acosh(x) = p,
- x = cosh(p) >= 1 must be satisfied.
- *****************************************/
- #ifndef SN_H
- #include "sn.h"
- #endif
-
- #if 0
-
- SComplex Cacosh(const SComplex& z) {
- // SComplex y = Csqrt(z * z - ONE); cannot be used.
- if(z == 0.0) return SComplex(0.0, MPi2()); // log(i) = i*pi/2
- if(Im(z) == 0.0){ // pure real z = x
- if(Re(z) <= 1.0) z.Real().SetError(z.Real().DOMAIN_ERR, "Cacosh(z) with z = x(x < 1.0))", 9118);
- return SComplex(Acosh(Re(z)), 0.0); // arcosh(x)
- }
- SComplex y = Csqrt(z + ONE) * Csqrt(z - ONE);
- return Clog(z + y);
- }
- #else /********************************/
-
- SComplex Cacosh(const SComplex& z) {
- if(z == 0.0) return SComplex(0.0, MPi2()); // log(i) = i*pi/2
- if(Im(z) == 0.0){ // pure real z = x
- if(Re(z) <= 1.0) z.Real().SetError(z.Real().DOMAIN_ERR, "Cacosh(z) with z = x(x < 1.0))", 9116);
- return SComplex(Acosh(Re(z)), 0.0); // arcosh(x)
- }
-
- //if(z == 0.0) return Clog(I);
- if(Im(z) > 0.0) return IU * Cacos(z);// i*arccos(z) in the upper half of the complex plane
- return MI * Cacos(z); // -i*arccos(z)
- }
- #endif
-
scfacosh.cpp : last modifiled at 2015/10/23 15:42:32(1,632 bytes)
created at 2017/10/06 15:21:28
The creation time of this html file is 2017/10/06 15:27:08 (Fri Oct 06 15:27:08 2017).